import QtQuick 1.0
import com.meego 1.0
Page {
    id:cardFurum

    property bool loading: carBrandModel.status == XmlListModel.Loading

    Rectangle{
        id:list_rect
        width:parent.width
        height: parent.height

        FlickListView {
                   id: article_list
                   width: listContent_rect.width
                   height: listContent_rect.height
                   model: carBrandModel
                   delegate: carBrandDelegate
                   highlight:Rectangle{color:"steelblue"}
                   highlightMoveSpeed: 9999999
         }


    }
    XmlListModel{
        id:carBrandModel
        source: "http://sp.autohome.com.cn/Nokia/ClubBrandCount.ashx?type=1"
        query: "/Response/Brands/Content/Brand"

         XmlRole { name: "brandId"; query: "Id/string()" }
         XmlRole { name: "brandName"; query: "Name/string()" }
         XmlRole { name: "brandLetter"; query: "BrandLetter/string()" }
         XmlRole { name: "BBSNum"; query: "BBSNum/string()" }
    }
    Component{
        id:carBrandDelegate
        Item{
            id:delegate
            height: 30

            Rectangle{
                id:text_rect
                width: parent.width;height: parent.height
                color: index%2===0 ? "#efefef":"white"
                Text{
                    id:brand
                    text: breandName+"("+brandLetter+")"
                    color: delegate.ListView.isCurrentItem ? "white": "black"
                    font{
                        family:"Helvetica";pointSize:16;bold:true
                    }
                    anchors.left: parent.left
                    anchors.leftMargin: 15
                    anchors.verticalCenter: parent.verticalCenter

                }
               MouseArea{
                   anchors.fill: parent
                   onClicked:{
                       delegate.ListView.view.currentIndex=index;
                       console.log("go to forum:"+brandName);
                       console.log("go to brandId:"+brandId);

                   }
               }
            }
        }
    }
}
